package net.tngou.tpage.service;

import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.imageio.ImageIO;



import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.lang3.time.DateUtils;

import net.tngou.tpage.dao.UserDao;
import net.tngou.tpage.jdbc.PageUtil;
import net.tngou.tpage.pojo.User;







public class UserService  extends BaseService
{
	
	private final static  String fullyQualifiedName = "User_List";
	

		
			/**
			 * 登录设置
			 * @param access_token
			 * @param refresh_token
			 * @param save_login
			 * @param user
			 */
			public void saveLogin(String access_token,String refresh_token,User user) {
				
				if(!access_token.equals(user.getAccess_token()))
				{
					User bean = new User();
					Map<String, Object> map = new HashMap<String, Object>();
					map.put("access_token", access_token);
					map.put("refresh_token", refresh_token);
					map.put("password", user.getPassword());
					map.put("init", 0);
					bean.update(map ,user.getId());
				}
				UserDao dao = new UserDao();					
				dao.updateLogin(access_token,user);				
						
			}
			
			/**
			 * 查询用户
			 * @param page 当前页
			 * @param size 大小
			 * @param main 实体
			 * @param role 角色
			 * @param keyword 关键词 
			 * @return
			 */
			public PageUtil getPage(int page,int size,long main,long role,String keyword) {
				UserDao dao = new UserDao();
				return dao.getPage(page, size, main, role, keyword);
			}



			
}
